<template>
  <div class="hljs">
    <el-form :model="dataFrom"
             size="small"
             ref="dataForm"
             :rules="dataFormRules"
             label-width="120px">
      <div class="system">通讯配置</div>
      <el-form-item label="日报接收人" prop="acceptPhones">
        <el-input v-model="dataFrom.acceptPhones" placeholder="请输入手机号码，多个手机号码以‘,’分割"></el-input>
      </el-form-item>
      <el-form-item label="日报管理人员" prop="managerPhones">
        <el-input v-model="dataFrom.managerPhones" placeholder="请输入手机号码，多个手机号码以‘,’分割"></el-input>
      </el-form-item>
      <el-form-item label="日报审核人员" prop="auditorPhones">
        <el-input v-model="dataFrom.auditorPhones" placeholder="请输入手机号码，多个手机号码以‘,’分割"></el-input>
      </el-form-item>
      <el-form-item label="日报确认人" prop="confirmPhones">
        <el-input v-model="dataFrom.confirmPhones" placeholder="请输入手机号码，多个手机号码以‘,’分割"></el-input>
      </el-form-item>
    </el-form>
    <div style="text-align: left">
      <el-button
        :loading="dialogLoading"
        @click="submitForm"
        type="primary"
        size="small">
        保存
      </el-button>
    </div>
  </div>
</template>

<script>
  import {queryConfigDatily} from '@/api/dailyweekly/workflow'
  export default {
    props: {
      dataFrom: {
        type: Object
      },
    },
    data() {
      return {
        dialogLoading: false,
        // dataFrom: {
        //   acceptPhones: '',
        //   managerPhones: '',
        //   auditorPhones: ''
        // },
        dataFormRules: {
          acceptPhones: [
            { required: true, message: '请输入日报接受人电话号码', trigger: 'blur' }
          ],
          managerPhones: [
            { required: true, message: '请输入日报管理人员电话号码', trigger: 'blur' }
          ],
          auditorPhones: [
            { required: true, message: '请输入日报审核人员电话号码', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      submitForm () {
        this.$refs['dataForm'].validate(valid => {
          if (valid) {
            this.AddConfigDaily()
          }
        })
      },
      async AddConfigDaily () {
        const data = await queryConfigDatily(this.dataFrom, 'post')
        if (data) {
          if (data.code === 200) {
            this.queryConfigDatily()
          }
        }
      }
    }
  }
</script>

<style scoped>
  .hljs{
    line-height: 1.8;
    font-family: Menlo,Monaco,Consolas,Courier,monospace;
    font-size: 12px;
    padding: 18px 24px;
    background-color: #fafafa;
    border: 1px solid #eaeefb;
    margin-bottom: 25px;
    border-radius: 4px;
    -webkit-font-smoothing: auto;
  }
  .system{
    font-size: 20px;
    text-align: left;
    line-height: 40px;
    margin-top: -10px;
    font-weight: bold;
  }
</style>
